using System;
using System.Collections.Generic;
using System.Text;

using System.Collections;
using Entity;
using System.Data.SqlClient;
using Menfram.DAL.Abstract;
using Menfram.Entity.Interface;

namespace DAO
{
    public class TableDAO : AbstractDAO<TableEntity>
    {
        public IList<TableEntity> findAllTables()
        {
            IList<TableEntity> lista = new List<TableEntity>();
            try
            {
                string sql = "select  * from sysobjects where xtype = 'U'";
                SqlDataReader reader = (SqlDataReader)executeQuery(sql);
                while (reader.Read())
                {
                    lista.Add((TableEntity)returnEntity(reader));
                }
                reader.Close();
            }
            catch
            {
            }

            return lista;
        }

        private TableDAO() { }
        private static TableDAO dao = null;
        public static TableDAO getInstance() {
            if (dao == null) {
                dao = new TableDAO();
            }
            return dao;
        }

        public override Type getTipo()
        {
            return typeof(TableEntity);
        }
       


    }
}
